import request from '#/utils/requestAbort.js';
import type { IApplyType } from './type';

// 查询交易单元经纬度配置列表
export async function postQueryLongLatConfigList(params?: {
  needPermission?: boolean;
  menuCode?: string;
}) {
  return request('/generation-common/stationLongLatConfig/queryLongLatConfigList', {
    method: 'POST',
    data: params,
  });
}

// 新增单元经纬度配置
export async function postSaveLongLatConfigList(params: IApplyType) {
  return request('/configuration/stationLongLatConfig/saveLongLatConfigList', {
    method: 'POST',
    data: params,
  });
}

// 编辑单元经纬度配置
export async function postUpdateLongLatConfigList(params: IApplyType) {
  return request('/configuration/stationLongLatConfig/updateLongLatConfigList', {
    method: 'POST',
    data: params,
  });
}

// 查询省列表
export async function postQueryProvinceList(params: { menuCode?: string }) {
  return request('/power/station/getStationLevelThree', {
    method: 'POST',
    data: params.menuCode,
  });
}

// 删除单元经纬度配置
export async function postRemoveLongLatConfigList(params: { id?: number }) {
  return request('/configuration/stationLongLatConfig/removeLongLatConfigList', {
    method: 'POST',
    data: params,
  });
}

//根据结算单元id查询结算单元信息
export async function postGetStationsByIds(params: { stationIds?: string[] }) {
  return request('/power/station/getStationsByIds', {
    method: 'POST',
    data: params,
  });
}

// 省份-交易中心-场站（数据权限）
export async function queryMarketList(menuCode: string) {
  return request(`/power/dataPower/common/${menuCode}/t_station`, {
    method: 'GET',
  });
}
